package com.g13.virtualpethospital.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * @Title: TestPaperBriefEntity
 * @Author yyj1205
 * @Package com.g13.virtualpethospital.entity
 * @Date 24/3/2024 20:00
 * @description: 精简了问题内容的试卷
 */
@ApiModel(description = ": 精简了问题内容的试卷")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document("TestPaper")
public class TestPaperBriefEntity {
    /**
     * 试卷标题
     */
    @ApiModelProperty(value = "试卷标题", position = 1)
    private String headline;
    /**
     * 试卷ID
     */
    @Id
    @ApiModelProperty(value = "试卷ID", position = 2)
    private String paperId;
    /**
     * 问题的ID
     */
    @ApiModelProperty(value = "问题的ID", position = 3)
    private String[] questions;
    /**
     * 试卷总分
     */
    @ApiModelProperty(value = "试卷总分", position = 4)
    private long totalScore;
    /**
     * 考试时间
     */
    @ApiModelProperty(value = "考试最大时间", position = 5)
    private long time;
    /**
     * 试卷各题的分值
     */
    @ApiModelProperty(value = "试卷各题的分值", position = 6)
    private int[] scores;
    TestPaperBriefEntity(TestPaperEntity testPaperEntity){
        headline = testPaperEntity.getHeadline();
        paperId = testPaperEntity.getPaperId();
        totalScore = testPaperEntity.getTotalScore();
        time = testPaperEntity.getTime();
        scores = testPaperEntity.getScores();
        questions = new String[testPaperEntity.getQuestions().length];
        for(int i = 0; i < questions.length; ++i){
            questions[i] = testPaperEntity.getQuestions()[i].getQuestionId();
        }
    }
}
